/*
 * Copyright 2025 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package androidx.compose.ui.text.font

import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.font.FontSynthesis
import androidx.compose.ui.text.font.FontWeight

internal actual fun createPlatformResolveInterceptor(): PlatformResolveInterceptor =
    OHOSResolveInterceptor

private object OHOSResolveInterceptor : PlatformResolveInterceptor {

    private val boldTextEnabled: Boolean by lazy { isBoldTextEnabled() }

    override fun interceptFontFamily(fontFamily: FontFamily?): FontFamily? {
        return fontFamily
    }
}

/**
 * 判断是否开启了“粗体文本”无障碍开关。
 * 先占位实现：返回 false。
 *
 * 后续接入思路（任选其一，根据你项目依赖与 API 可用性）：
 * 1) 若有 Java API：
 *    - 查找类似 ohos.accessibility.config 的能力（如有）暴露 boldText 状态；
 * 2) 若只有 ArkTS 能力，可通过平台通道或 HAP 提供能力给 Java/Kotlin；
 * 3) 若系统通过系统参数暴露，可用 ohos.system.Parameter 读取约定 key，再做解析；
 * 4) 没有官方开关时，可跟随字体缩放阈值或应用内设置作为替代。
 */
@Suppress("KotlinConstantConditions")
private fun isBoldTextEnabled(): Boolean {
    // TODO: 接入 OHOS 实际无障碍开关
    return false
}